#ifndef CUSTOM_JUMP_FLOOD_RENDER_INCLUDED
#define CUSTOM_JUMP_FLOOD_RENDER_INCLUDED

#include "GenerateSdfCommon.hlsl"

// Uniform Parameter
uniform int JumpLength;                          // Current Cascade Level n
Texture2D _BlitTexture;
SamplerState sampler_BlitTexture;

uniform Texture2D _ColorTexture;                    // n + 1 Level Merge Result
SamplerState sampler_ColorTexture;

float4 JumpFloodRenderFragment(Vert2Frag Input) : SV_TARGET {
    float4 CoordResult = _BlitTexture.Load(int3(Input.ScreenUV * _ScreenParams.xy, 0));
    float4 RenderResult = _ColorTexture.Load(int3(CoordResult.xy, 0));

    // RenderResult.a = ((int)CoordResult.a) % 32 / 32.0;
    // RenderResult.a = 1.0 / CoordResult.a * 32.0;
    RenderResult.a = CoordResult.a / sqrt(_ScreenParams.y * _ScreenParams.y + _ScreenParams.x * _ScreenParams.x);

    return RenderResult;
}
#endif